//
// Decompiled by Jadx - 494ms
//
package fp;

import android.text.TextUtils;
import android.view.View;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedHelpers;
import fi.b;
import fi.e;
import fi.w;
import fn.j;
import fn.x;
import fn.y;
import fo.c;
import java.util.Iterator;
import me.plusne.NativeTools;
import me.plusne.common.Json.JsonHookStatic;
import o.a;
import org.luckypray.dexkit.query.matchers.AnnotationElementsMatcher;
import org.luckypray.dexkit.query.matchers.AnnotationMatcher;
import org.luckypray.dexkit.query.matchers.MethodMatcher;
import org.luckypray.dexkit.query.matchers.base.AnnotationEncodeValueMatcher;
import org.luckypray.dexkit.query.matchers.base.StringMatcher;
import org.luckypray.dexkit.result.MethodData;
import org.luckypray.dexkit.result.UsingFieldData;
import r.f;

@a("DY")
public final class o extends x {
    public static String cp;
    public static String cq;
    public static String cr;

    public static void cs(o oVar, XC_MethodHook.MethodHookParam methodHookParam, Object obj) {
        Object objectField;
        oVar.getClass();
        if (obj == null) {
            f i = f.i();
            i.j();
            i.l("hook comment失败");
            j.w(methodHookParam);
            return;
        }
        Object objectField2 = XposedHelpers.getObjectField(obj, "emoji");
        try {
            objectField = XposedHelpers.getObjectField(obj, "mImageList");
        } catch (NoSuchFieldError e) {
            e.printStackTrace();
            objectField = XposedHelpers.getObjectField(obj, "imageList");
        }
        Object obj2 = objectField;
        Object objectField3 = XposedHelpers.getObjectField(obj, "aliasAweme");
        Object objectField4 = XposedHelpers.getObjectField(obj, "user");
        Object objectField5 = XposedHelpers.getObjectField(obj, "commentAudio");
        String as = j.as(objectField4, "nickname");
        String as2 = j.as(obj, "text");
        JsonHookStatic jsonHookStatic = y.by;
        w wVar = new w(jsonHookStatic.getActivity());
        wVar.bj(fi.e.LIST_ITEM);
        wVar.bi("评论区长按操作");
        b bVar = new b();
        if (!TextUtils.isEmpty(as2)) {
            bVar.d("复制评论内容", as2, "");
        }
        bVar.d("复制用户昵称", as, "");
        if (objectField2 != null) {
            bVar.b("下载表情图片");
        }
        Object obj3 = null;
        if (obj2 != null) {
            bVar.b("下载图片");
            try {
                obj3 = XposedHelpers.getObjectField(j.ab(obj2, "get", new Object[]{0}), "liveVideo");
                if (obj3 != null) {
                    bVar.b("下载图片视频");
                }
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
        Object obj4 = obj3;
        String at = j.at(objectField3);
        if (objectField3 != null && at != null && !TextUtils.isEmpty(at)) {
            bVar.b("下载视频");
        }
        if (objectField5 != null) {
            bVar.b("下载语音");
        }
        if (NativeTools.n(JsonHookStatic.l, jsonHookStatic.getUserInfo())) {
            bVar.b("复制源接口");
            bVar.b("复制textExtra");
        }
        bVar.b("默认操作");
        wVar.bd();
        wVar.ay(bVar);
        wVar.bk();
        wVar.c.setCanceledOnTouchOutside(true);
        wVar.ae = new n(obj, wVar, methodHookParam, as, obj4, objectField2, obj2, at, objectField5, 0);
    }

    public final void a() {
        if (y.by.getVersionCode() >= 290500) {
            Iterator it = c.z(MethodMatcher.create().usingStrings(new String[]{"cell_longpress"}).paramTypes(new String[]{"com.ss.android.ugc.aweme.comment.model.Comment"})).iterator();
            while (it.hasNext()) {
                j.be((MethodData) it.next(), new a(this));
            }
            return;
        }
        String e = fo.b.e("field");
        cp = e;
        if (TextUtils.isEmpty(e)) {
            MethodData t = c.t(MethodMatcher.create().addAnnotation(AnnotationMatcher.create().elements(AnnotationElementsMatcher.create().add("message", AnnotationEncodeValueMatcher.createString(StringMatcher.create("仅用于特殊情况下，不改变ViewState而更新UI的场景"))))));
            if (t.getDeclaredClass() != null) {
                MethodData t2 = c.t(MethodMatcher.create().declaredClass(t.getDeclaredClass().getName()).usingStrings(new String[]{"reducer"}));
                if (!t2.getUsingFields().isEmpty()) {
                    String fieldName = ((UsingFieldData) t2.getUsingFields().get(0)).getField().getFieldName();
                    cp = fieldName;
                    fo.b.g("field", fieldName);
                }
            }
        }
        if (cg.a.aa.getDeclaredClass() == null || cg.a.ab.getDeclaredClass() == null) {
            return;
        }
        j.bd(cg.a.aa.getClassName(), "onLongClick", new Object[]{View.class, new b(this)});
    }
}
